package com.djl.Zookeeper.watch;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;

import java.util.concurrent.CountDownLatch;

public class DefaultWatch implements Watcher {

    CountDownLatch countDownLatch;

    public void process(WatchedEvent event) {

        Event.KeeperState state = event.getState();
        String path = event.getPath();
        Event.EventType type = event.getType();

        switch (state) {
            case Disconnected:
                break;
            case SyncConnected:

                countDownLatch.countDown();
                break;
            case AuthFailed:
                break;
            case ConnectedReadOnly:
                break;
            case SaslAuthenticated:
                break;
            case Expired:
                break;
            case Closed:
                break;
        }
    }


    public void setCountDownLatch(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }
}
